package com.william.jdbcplus.core.dialect.pagination.impl;

import com.william.jdbcplus.core.dialect.pagination.IPagination;

/**
 * H2 数据库分页方言
 *
 * @author niliwei
 */
public class H2Pagination implements IPagination {

    @Override
    public String getPaginationSql(String originalSql, long offset, long limit) {
        long offsetParam = offset;
        long limitParam = limit;
        String sql = originalSql + " limit " + limitParam;
        if (offset > 0) {
            sql += (" offset " + offsetParam);
        }

        return sql;
    }
}
